package com.itheima.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.itheima.common.AmountConverter;
import com.itheima.common.StatusConverter;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单
 */
@Data
public class Orders implements Serializable {

    private static final long serialVersionUID = 1L;

    @ExcelIgnore
    private Long id;


    //订单号
    @ColumnWidth(20)
    @ExcelProperty(value = "订单号",index = 0)
    private String number;

    //订单状态 1待付款，2待派送，3已派送，4已完成，5已取消
    //使用类型转换器
    @ColumnWidth(10)
    @ExcelProperty(value = "订单状态",index = 1,converter = StatusConverter.class)
    private Integer status;


   // private String statusStr;

    @ExcelIgnore
    //下单用户id
    private Long userId;
    @ExcelIgnore
    //地址id
    private Long addressBookId;

    @ColumnWidth(25)
    @ExcelProperty(value = "下单时间",index = 5)
    @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
    //下单时间
    private LocalDateTime orderTime;

    @ExcelIgnore
    //结账时间
    private LocalDateTime checkoutTime;

    @ExcelIgnore
    //支付方式 1微信，2支付宝
    private Integer payMethod;

    @ColumnWidth(10)
    //@NumberFormat("0.00")
    @ContentStyle(dataFormat = 2)
    @ExcelProperty(value = "实收金额",index = 6,converter = AmountConverter.class )
    //实收金额
    private BigDecimal amount;

    @ExcelIgnore
    //备注
    private String remark;

    @ColumnWidth(10)
    @ExcelProperty(value = "用户",index = 2)
    //用户名
    private String userName;

    @ColumnWidth(15)
    @ExcelProperty(value = "手机号",index = 3)
    //手机号
    private String phone;

    @ColumnWidth(20)
    @ExcelProperty(value = "地址",index = 4)
    //地址
    private String address;

    @ExcelIgnore
    //收货人
    private String consignee;


    //逻辑视图

   /* public String getStatusStr() {
        String statusStr="状态：";
        switch (status) {
            case 1:
                statusStr+= "待付款";
                break;
            case 2:
                statusStr+= "待派送";
                break;
            case 3:
                statusStr+= "已派送";
                break;
            case 4:
                statusStr+= "已完成";
                break;
            case 5:
                statusStr+= "已取消";
                break;
            default:
                statusStr+= "未知";
        }
        return statusStr;
    }
*/

}
